const express = require('express');
const app = express();
const cors = require('cors');

// 使用express来设置静态资源目录
app.use(express.static('public'));

// 允许跨域
app.use(cors());

// 解析post请求的参数
app.use(express.urlencoded({
    extended: false
}));
app.use(express.json());

// 配置一级路由
app.use('/api', require('./routes/admin'));


// 监听端口
app.listen(3000, () => {
    console.log('3000端口开启');
});